
if exists (select 1 from sysobjects where name = 'del_schema' and type = 'P')
begin
   drop procedure del_schema
   print 'Procedure: del_schema deleted ...'
end
go
create procedure del_schema(
  @schemaid           int           = 1
)
as
begin
  set nocount on

  delete from Schemas where SchemaID = @schemaid
  delete from PlanSchema where SchemaID = @schemaid
--select * from schemas
--select * from PlanSchema

end
go
print 'Procedure: del_schema done ...'
go
grant exec on del_schema to prsadmins with grant option
go
grant exec on del_schema to prsusers
go


